<template>
	<view>
		<u-subsection :list="list" :current="curNow" @change="sectionChange"></u-subsection>
		<view>订单显示</view>
		<view>
			<u-popup :show="show" mode="center" @close="close" @open="open">
				<view>
					<u-button text="余额支付" @click="payBalance"></u-button><u-button text="微信支付" @click="payWeixin"></u-button>
				</view>
			</u-popup>
			<u-button text="去支付" @click="show = true"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: ['全部', '待支付', '进行中', '已支付'],
				curNow: 0,
				show:false
			}
		},
		methods: {
			sectionChange(index){
				this.curNow=index
			},
			open() {
				
			},
			close() {
				this.show=false
			},
			payBalance(){
				
			},
			payWeixin(){
				// 仅作为示例，非真实参数信息。
				uni.requestPayment({
					//服务提供商
				    provider: 'wxpay',
					//当前的时间
					timeStamp: String(Date.now()),
					//随机字符串，长度为32个字符以下
					nonceStr: 'A1B2C3D4E5',
					//统一下单接口返回的 prepay_id 参数值，提交格式如：prepay_id=xx
					package: 'prepay_id=wx20180101abcdefg',
					//签名算法，应与后台下单时的值一致
					signType: 'MD5',
					//签名
					//paySign = MD5(appId=wxd678efh567hg6787&
					//nonceStr=5K8264ILTKCH16CQ2502SI8ZNMTM67VS&
					//package=prepay_id=wx2017033010242291fcfe0db70013231072&
					//signType=MD5&timeStamp=1490840662&
					//key=qazwsxedcrfvtgbyhnujmikolp111111)
					//= 22D9B4E54AB1950F51E0649E8810ACD6
					paySign: '',
					success: function (res) {
						console.log('success:' + JSON.stringify(res));
					},
					fail: function (err) {
						console.log('fail:' + JSON.stringify(err));
					}
				});
			}
		}
	}
</script>

<style>

</style>